import http from './http'


// ------ 首页 ---------------
/**
 * 获取运营服务
 */
export function getService(data = {}) {
	return http({
		url: '/api/operator/getService',
		// identity: 'user',
		data
	})
}

// 订阅消息模板  post   127.0.0.1:8080/api/operateConfig/getInfoByAppId?appId=wxec1dcddfa22c77c4 
export function getInfoByAppId(data = {}) {
	return http({
		url: '/api/operateConfig/getInfoByAppId',
		identity: 'user',
		data
	})
}
// 租电--下次再取接口 
export function nextTake(data = {}) {
	return http({
		url: '/api/device/nextTake',
		identity: 'user',
		data
	})
}

/**
 * 地图设备
 */
export function mapList(data = {}) {
	return http({
		url: '/api/operator/mapListZfb',
		// identity: 'user',
		data
	})
}

/**
 * 地图设备-详情
 */
export function getDeviceDetail(data = {}) {
	return http({
		url: '/api/operator/getDeviceDetail',
		// identity: 'user',
		data
	})
}
// 获取用户可领取优惠券列表
export function couponListByUser(data) {
	return http({
		url: `/api/coupon/listByUser/${data}`,
		identity: 'user',
		method: 'GET'
	})
}
export function batteryTypeList(data) {
	return http({
		url: `/api/batteryType/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 获取设备的套餐信息
export function mealExchangeGetDeviceMeal(data = {}) {
	return http({
		url: '/api/mealExchange/getDeviceMeal',
		identity: 'user',
		data
	})
}
export function depositList(data) {
	return http({
		url: `/api/deposit/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 告知已经签署了押金与套餐协议
export function userSignProtocol(data) {
	return http({
		url: `/api/user/signProtocol/${data}`,
		identity: 'user',
	})
}

// 查询是否签署押金与套餐协议
export function userIsSignProtocol(data) {
	return http({
		url: `/api/user/isSignProtocol/${data}`,
		identity: 'user',
		method: 'GET',
	})
}

// 获取推广员信息
export function promotionGetInfos() {
	return http({
		url: `/api/promotion/getInfo`,
		identity: 'user',
		method: 'GET',

	})
}
// 获取推广员详细信息
export function promotionGetInfo(data) {
	return http({
		url: `/api/promotion/getInfo/${data}`,
		identity: 'user',
		method: 'GET',

	})
}
// 获取我的好友（推广用户）
export function promotionPromotionRecordss(data) {
	return http({
		url: `/api/promotion/promotionRecord`,
		identity: 'user',
		method: 'GET',
		data
	})
}
// 推广用户佣金提现
export function promotionAmountWithdraw() {
	return http({
		url: `/api/promotion/amountWithdraw`,
		identity: 'user',
		method: 'GET',
	})
}
// 申请成为推广用户
export function promotionUserApply() {
	return http({
		url: `/api/promotion/userApply`,
		identity: 'user',
	})
}

export function userWithdrawRecordList(data = {}) {
	return http({
		url: '/api/userWithdrawRecord/list',
		identity: 'user',
		method: 'GET',
		data
	})
}

export function zfbDepositPay(data = {}) {
	return http({
		url: '/api/pay/zfbDepositPay',
		identity: 'user',
		data
	})
}


// 领取优惠券
export function APIreceive(data) {
	return http({
		url: `/api/coupon/receive`,
		identity: 'user',
		method: 'GET',
		data
	})
}


// 获取用户已领取优惠券列表
export function couponGetUserCoupon(data = {}) {
	return http({
		url: '/api/coupon/getUserCoupon',
		identity: 'user',
		method: 'GET',
		data
	})
}

// 新用户赠送优惠券列表获取
export function operatorGetGiveInfo(data = {}) {
	return http({
		url: '/api/operator/getGiveInfo',
		identity: 'user',
		method: 'GET',
		data
	})
}
// 使用现金劵
export function couponCashCoupon(data = {}) {
	return http({
		url: '/api/coupon/cashCoupon',
		identity: 'user',
		method: 'GET',
		data
	})
}

// 使用暂存劵
export function couponHoldCoupon(data = {}) {
	return http({
		url: '/api/coupon/holdCoupon',
		identity: 'user',
		method: 'GET',
		data
	})
}
// 获取暂存规则(为空则是运营商未开放该功能)
export function holdGetHold() {
	return http({
		url: '/api/hold/getHold',
		identity: 'user',
		method: 'GET',
	})
}
// 使用暂存劵
export function holdUseHold(data) {
	return http({
		url: '/api/hold/useHold',
		identity: 'user',
		method: 'GET',
		data
	})
}


/**
 * 购买（续费）套餐（换电）
 */
export function buyMeal(data = {}) {
	return http({
		url: '/api/mealExchange/buyMeal',
		identity: 'user',
		data
	})
}

/**
 * 提前结束套餐（换电）
 */
export function endMeal(data = {}) {
	return http({
		url: '/api/mealExchange/endMeal',
		identity: 'user',
		data
	})
}





// ------  换电柜 -----------

/**
 * 登录---扫一扫
 */
export function scanDevice(data = {}) {
	return http({
		url: '/api/device/scan',
		identity: 'user',
		default: true,
		data
	})
}

// 测试登录
export function smallLoginTest(data = {}) {
	return http({
		url: '/api/login/smallLoginTest',
		identity: 'user',
		default: true,
		data
	})
}

// 没登录---扫一扫
export function scanNotLogin(data = {}) {
	return http({
		url: '/api/device/scanNotLogin',
		identity: 'user',
		default: true,
		data
	})
}

// 获取有没有开通小程序申请成为推广员的权限
export function promotionGetConfig() {
	return http({
		url: `/api/promotion/getConfig`,
		identity: 'user',
		method: 'GET',
	})
}

/**
 * 查询用户当前的套餐（已购买且有效的）
 */
export function getMyMeal(data = {}) {
	return http({
		url: '/api/userMeal/getMyMeal',
		identity: 'user',
		data
	})
}

/**
 * 换电设备套餐列表+押金详情
 */
export function getDeviceMeal(data = {}) {
	return http({
		url: '/api/mealExchange/getDeviceMeal',
		// identity: 'user',
		data
	})
}

/**
 * 换电租赁电池须知+租赁电池套餐协议
 */
export function settingExchange(data = {}) {
	return http({
		url: '/api/settingExchange/getInfo',
		identity: 'user',
		data
	})
}
// 是否显示试用套餐按钮
export function couponIsTryCoupon(data) {
	return http({
		url: '/api/coupon/isTryCoupon',
		identity: 'user',
		method: 'GET',
		data
	})
}
// 使用试用券
export function couponTryCoupon(data) {
	return http({
		url: '/api/coupon/tryCoupon',
		identity: 'user',
		method: 'GET',
		data
	})
}

/**
 * 开门
 */
export function openDoor(data = {}) {
	return http({
		url: '/api/device/openDoor',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 重新开门
 */
export function restartOpen(data = {}) {
	return http({
		url: '/api/device/restartOpen',
		identity: 'user',
		default: true,
		data
	})
}


/**
 * 换电订单列表
 */
export function exchangeOrder(data = {}) {
	return http({
		url: '/api/orderExchange/list',
		identity: 'user',
		data
	})
}

/**
 * 换电订单详情
 */
export function exchangeOrderDetail(data = {}) {
	return http({
		url: '/api/orderExchange/getDetail',
		identity: 'user',
		data
	})
}


// ------  充电柜 -----------

/**
 * 充电充电使用须知+占仓扣费说明
 */
export function settingCharge(data = {}) {
	return http({
		url: '/api/settingCharge/getInfo',
		identity: 'user',
		data
	})
}

/**
 * 开启仓门-充电
 */
export function openDoorChr(data = {}) {
	return http({
		url: '/api/deviceChr/openDoorChr',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 重新开门
 */
export function reOpenChr(data = {}) {
	return http({
		url: '/api/deviceChr/reOpenChr',
		identity: 'user',
		data
	})
}


/**
 * 取消订单
 */
export function cancelChrOrder(data = {}) {
	return http({
		url: '/api/deviceChr/cancelChrOrder',
		identity: 'user',
		data
	})
}


/**
 * 充电订单列表
 */
export function orderCharge(data = {}) {
	return http({
		url: '/api/orderCharge/list',
		identity: 'user',
		data
	})
}

/**
 * 订单详情
 */
export function orderChargeDetail(data = {}) {
	return http({
		url: '/api/orderCharge/getDetail',
		identity: 'user',
		data
	})
}


/**
 * 结束充电
 */
export function endCharge(data = {}) {
	return http({
		url: '/api/orderCharge/endCharge',
		identity: 'user',
		data
	})
}

/**
 * 支付取电
 */
export function payAndGet(data = {}) {
	return http({
		url: '/api/orderCharge/payAndGet',
		identity: 'user',
		default: true,
		data
	})
}



// --------  扫码租车 -------------

/**
 * 设备和站点信息
 */
export function getDeviceByDeviceNo(data = {}) {
	return http({
		url: '/api/device/getDeviceByDeviceNo',
		identity: 'user',
		data
	})
}

/**
 * 查询当前设备代理商或运营商租车套餐列表
 */
export function getListMealRentByDeviceNo(data = {}) {
	return http({
		url: '/api/mealRent/getListMealRentByDeviceNo',
		identity: 'user',
		data
	})
}

/**
 * 判断用户可否下租车单
 */
export function judgeCanRentCar(data = {}) {
	return http({
		url: '/api/userRent/judgeCanRentCar',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 购买/续期当前代理商/运营商换电套餐并下租车单
 */
export function purchaseMealOrder(data = {}) {
	return http({
		url: '/api/mealOrder/purchaseMealOrder',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 汽车押金/租车电池押金预支付订单
 */
export function chargeDepositMakeOrder(data = {}) {
	return http({
		url: '/api/depositOrder/chargeDepositMakeOrder',
		identity: 'user',
		data
	})
}
export function userOverdueList(data = {}) {
	return http({
		url: '/api/userOverdue/list',
		identity: 'user',
		data,
		method: 'GET'
	})
}

/**
 * 获取设备当前代理商或运营商租赁协议
 */
export function getRentCarContract(data = {}) {
	return http({
		url: '/api/settingRent/getRentCarContract',
		identity: 'user',
		data
	})
}

/**
 * 订单列表（租车）
 */
export function rentCarOrder(data = {}) {
	return http({
		url: '/api/orderRent/list',
		identity: 'user',
		data
	})
}

/**
 * 租车订单详情
 */
export function rentCarOrderDetail(data = {}) {
	return http({
		url: '/api/orderRent/getDetail',
		identity: 'user',
		data
	})
}

/**
 * 归还车辆
 */
export function returnCar(data = {}) {
	return http({
		url: '/api/orderRent/returnCar',
		identity: 'user',
		default: true,
		data
	})
}



// -------- 个人中心 -------------

// 电池寄存
export function holdUseHoldV2(data) {
	return http({
		url: `/api/hold/useHoldV2`,
		identity: 'user',
		method: 'GET',
		data

	})
}

// 小程序归还电池
export function deviceReturnOpenDoor(data = {}) {
	return http({
		url: '/api/device/returnOpenDoor',
		identity: 'user',
		data
	})
}


// 修改用户头像和昵称
export function userEdit(data) {
	return http({
		url: '/api/user/edit',
		identity: 'user',
		data
	})
}


/**
 * 用户信息查询
 */
export function getUserInfo(data = {}) {
	return http({
		url: '/api/user/getInfo',
		identity: 'user',
		data
	})
}

/**
 * 更新用户信息
 */
export function editUserInfo(data = {}) {
	return http({
		url: '/api/user/edit',
		identity: 'user',
		data
	})
}


/**
 * 退出登录-删除token缓存
 */
export function logout(data = {}) {
	return http({
		url: '/api/user/logout',
		identity: 'user',
		data
	})
}


/**
 * 我的电池
 */
export function getMyBattery(data = {}) {
	return http({
		url: '/api/battery/getMyBattery',
		identity: 'user',
		default: true,
		data
	})
}

/**
 * 获取钱包信息（余额与押金）
 */
export function getBalance(data = {}) {
	return http({
		url: '/api/user/getBalance',
		identity: 'user',
		data
	})
}


/**
 * 我的钱包 - 订单明细
 */
export function tradeRecord(data = {}) {
	return http({
		url: '/api/tradeRecord/list',
		identity: 'user',
		data
	})
}



/**
 * 押金明细
 */
export function depositOrder(data = {}) {
	return http({
		url: '/api/depositOrder/list',
		identity: 'user',
		data
	})
}
export function depositOrderZfbList(data = {}) {
	return http({
		url: '/api/depositOrder/zfbList',
		identity: 'user',
		data
	})
}
export function repairDeposit(data = {}) {
	return http({
		url: '/api/repairDeposit',
		identity: 'user',
		data
	})
}

/**
 * 押金提现
 */
export function depositWithdraw(data = {}) {
	return http({
		url: '/api/depositOrder/withdraw',
		identity: 'user',
		data
	})
}


/**
 * 充值套餐列表
 */
export function mealList(data = {}) {
	return http({
		url: '/api/settingTopUp/list',
		identity: 'user',
		data
	})
}

/**
 * 充值
 */
export function recharge(data = {}) {
	return http({
		url: '/api/pay/zfbPay',
		identity: 'user',
		data
	})
}

/**
 * 我的ic卡列表
 */
export function icList(data = {}) {
	return http({
		url: '/api/ic/icList',
		identity: 'user',
		data
	})
}

/**
 * 绑定ic卡
 */
export function icBind(data = {}) {
	return http({
		url: '/api/ic/icBind',
		identity: 'user',
		data
	})
}

/**
 * 注销卡号
 */
export function icCancel(data = {}) {
	return http({
		url: '/api/ic/icCancel',
		identity: 'user',
		data
	})
}

/**
 * 添加意见反馈
 */
export function feedBack(data = {}) {
	return http({
		url: '/api/feedback/addFeedback',
		identity: 'user',
		data
	})
}

// 获取百度人脸识别token
export function getAutonymToken(data) {
	return http({
		url: `/api/user/getAutonymToken`,
		identity: 'user',
		method: 'GET',
		data
	})
}
export function getAutonymResult(verifyToken, data) {
	return http({
		url: `/api/user/getAutonymResult/${verifyToken}`,
		identity: 'user',
		method: 'GET',
		data
	})
}


export function getPayList(data) {
	return http({
		url: `/api/operateConfig/getPayList`,
		method: 'GET',
		identity: 'user',
		data
	})
}


export function returnOpenDoor(data) {
	return http({
		url: `/api/device/returnOpenDoor`,
		identity: 'user',
		method: 'GET',
		data
	})
}
export function pastUserMeal(id) {
	return http({
		url: `/api/userMeal/pastUserMeal/${id}`,
		identity: 'user',
		method: 'GET'
	})
}

export function getCertifyId(data) {
	return http({
		url: `/api/user/getCertifyId`,
		identity: 'user',
		data
	})
}
export function payOverdueOrder(data) {
	return http({
		url: `/api/userOverdue/payOverdueOrder`,
		identity: 'user',
		data
	})
}
export function isOverdue(id) {
	return http({
		url: `/api/userOverdue/isOverdue`,
		identity: 'user',
		method: 'GET'
	})
}
export function settingTopUpList(id) {
	return http({
		url: `/api/settingTopUp/list`,
		identity: 'user',
		method: 'GET'
	})
}
export function tryCoupon(data) {
	return http({
		url: `/api/coupon/tryCoupon`,
		identity: 'user',
		method: 'GET',
		data
	})
}
export function isTryCoupon(data) {
	return http({
		url: `/api/coupon/isTryCoupon`,
		identity: 'user',
		method: 'GET',
		data
	})
}
export function zfbZhimaCredit(data) {
	return http({
		url: `/api/zfbZhimaCredit`,
		identity: 'user',
		method: 'post',
		data
	})
}
export function zfbZhimaCancel(data) {
	return http({
		url: `/api/zfbZhimaCancel`,
		identity: 'user',
		method: 'post',
		data
	})
}

// 测试签约
export function orderTestSigned() {
	return http({
		url: `/api/order/test/signed`,
		identity: 'user',
		method: 'post',

	})
}

//  ----------后台管理 -----------start


// 首页
export function mchHomeData(data) {
	return http({
		url: '/api/mch/homeData',
		identity: 'user',
		method: 'GET',
		data
	})
}

// 首页---设备管理(数量)
export function mchDeviceNum() {
	return http({
		url: `/api/mch/deviceNum`,
		identity: 'user',
		method: 'GET',
	})
}


// 提现记录列表
export function withdrawRecordList(data) {
	return http({
		url: '/api/withdrawRecord/list',
		identity: 'user',
		method: 'GET',
		data
	})
}

// 添加账户
export function accountSave(data) {
	return http({
		url: '/api/account/save',
		identity: 'user',
		data
	})
}

// 获取可提现余额
export function withdrawRecordGetWithdrawMoney() {
	return http({
		url: '/api/withdrawRecord/getWithdrawMoney',
		identity: 'user',
		method: 'GET',
	})
}

// 发起提现
export function withdrawRecordWithdraw(data) {
	return http({
		url: '/api/withdrawRecord/withdraw',
		identity: 'user',
		data
	})
}

// 我的账户列表
export function accountList() {
	return http({
		url: '/api/account/list',
		identity: 'user',
		method: 'GET',
	})
}
// 根据id删除账户
export function accountDelById(data) {
	return http({
		url: `/api/account/delById/${data}`,
		identity: 'user',
		method: 'GET',
	})
}

// 编辑
export function accountEdit(data) {
	return http({
		url: '/api/account/edit',
		identity: 'user',
		data
	})
}

// 禁仓记录列表
export function mchCabinetDisableRecordList(data) {
	return http({
		url: `/api/mch/cabinetDisableRecord/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 设备告警列表
export function mchAlarmList(data) {
	return http({
		url: `/api/mch/alarm/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 电池告警列表
export function mchBatteryAlarmList(data) {
	return http({
		url: `/api/mch/batteryAlarm/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 意见反馈列表
export function mchFeedbackList(data) {
	return http({
		url: `/api/mch/feedback/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 电池列表
export function mchBatteryList(data) {
	return http({
		url: `/api/mch/battery/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 电池数量统计
export function mchBatteryBatteryCount(data) {
	return http({
		url: `/api/mch/battery/batteryCount`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 获取代理商套餐列表
export function mchMealExchangeGetAgentMealList(data) {
	return http({
		url: `/api/mch/mealExchange/getAgentMealList/${data}`,
		identity: 'user',
		method: 'GET',

	})
}

// 获取代理商下拉列表
export function mchAgentItemList() {
	return http({
		url: `/api/mch/agent/itemList`,
		identity: 'user',
		method: 'GET',
	})
}

// 套餐列表
export function mchMealExchangeList(data) {
	return http({
		url: `/api/mch/mealExchange/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 套餐删除
export function mchMealExchange(data) {
	return http({
		url: `/api/mch/mealExchange/del/${data}`,
		identity: 'user',
		method: 'GET',

	})
}

// 分配套餐给代理商
export function mchMealExchangeAddOrUpdateAgentMeal(data) {
	return http({
		url: '/api/mch/mealExchange/addOrUpdateAgentMeal',
		identity: 'user',
		data
	})
}

// 获取电池类型列表
export function batteryTypeItemList(data) {
	return http({
		url: `/api/mch/batteryType/itemList`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 修改套餐
export function mealExchangeUpdate(data) {
	return http({
		url: '/api/mch/mealExchange/update',
		identity: 'user',
		data
	})
}
// 获取快要过期的用户套餐(3天内) 
export function userMealPastUserMeal(data) {
	return http({
		url: `/api/userMeal/pastUserMeal/${data}`,
		identity: 'user',
		method: 'GET',

	})
}

// 新增套餐
export function mealExchangeSave(data) {
	return http({
		url: '/api/mch/mealExchange/save',
		identity: 'user',
		data
	})
}

// 设备列表
export function deviceList(data) {
	return http({
		url: `/api/mch/device/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 设备详情
export function deviceDetail(data) {
	return http({
		url: `/api/mch/device/detail`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 设备仓位开门
export function maintOpenDoor(data) {
	return http({
		url: '/api/mch/device/openDoor',
		identity: 'user',
		data
	})
}

// 设备仓门禁用/启用
export function deviceCabinetDisableChange(data) {
	return http({
		url: '/api/mch/device/cabinetDisableChange',
		identity: 'user',
		data
	})
}


// 地图列表
export function deviceMapDeviceList(data) {
	return http({
		url: `/api/mch/device/mapDeviceList`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 扫码绑定设备获取设备信息
export function getSimpleByDeviceNo(data) {
	return http({
		url: `/api/mch/device/getSimpleByDeviceNo`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 扫码绑定设备修改设备信息
export function deviceEdit(data) {
	return http({
		url: '/api/mch/device/edit',
		identity: 'user',
		data
	})
}

// 查询报障列表
export function faultList(data) {
	return http({
		url: `/api/mch/fault/list`,
		identity: 'user',
		method: 'GET',
		data
	})
}

// 处理报障
export function faultFaultHandle(data) {
	return http({
		url: '/api/mch/fault/faultHandle',
		identity: 'user',
		data
	})
}

// 查询报障详情
export function faultDetail(data) {
	return http({
		url: `/api/mch/fault/detail`,
		identity: 'user',
		method: 'GET',
		data
	})
}

//  ----------后台管理 -----------end